package com.teamclub.base.controllers;

import com.fasterxml.jackson.databind.JsonNode;
import com.teamclub.base.forms.SendMsgForm;
import com.teamclub.base.services.sendmsg.ISendMsg;
import com.teamclub.util.libs.Eithers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("com.teamclub.base.controllers.SendMsgController")
@RequestMapping("/base/sendmsg")
public class SendMsgController {

    @Autowired
    @Qualifier("SendMsgFactory")
    private ISendMsg sendMsg;

    @PostMapping("smsPush")
    public JsonNode smsPush(@RequestBody SendMsgForm form) {
        return Eithers.toJson(sendMsg.identifyCodeSend(form));
    }

    @PostMapping("smsVerify")
    public JsonNode smsVerify(@RequestBody SendMsgForm form) {
        return Eithers.toJson(sendMsg.identifyCodeVerify(form));
    }

    @PostMapping("templatePush")
    public JsonNode templatePush(@RequestBody SendMsgForm form) {
        return null;
    }

}
